# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=sox
pkgver=14.4.2
pkgrel=2
pkgdesc="The Swiss Army knife of sound processing tools"
arch=('i686' 'x86_64')
url="http://sox.sourceforge.net/"
license=('GPL' 'LGPL')
depends=('libltdl' 'file' 'libsndfile' 'libpng' 'lame' 'opencore-amr' 'gsm')
makedepends=('libao' 'libmad' 'libid3tag' 'wavpack' 'libpulse' 'opusfile' 'twolame')
checkdepends=('time')
optdepends=('libao: for ao plugin'
            'libmad: for mp3 plugin'
            'libid3tag: for mp3 plugin'
            'wavpack: for wavpack plugin'
            'libpulse: for pulse plugin'
	    'opusfile: for opus plugin'
            'twolame: for mp3 plugin')
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2 sox-dynamic.patch)
sha1sums=('dc9668256b9d81ef25d672f14f12ec026b0b4087'
          '9c71fa36596ed127b1bb367cfbab3b52cd2ecb6d')

prepare() {
  cd ${pkgname}-${pkgver}
  sed -i 's|man1/sox.1 soxeffect.7|man1/sox.1.gz soxeffect.7.gz|' Makefile.in
  patch -p1 -i "${srcdir}/sox-dynamic.patch"
  aclocal
  automake
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --sysconfdir=/etc \
    --with-dyn-default --with-distro="Arch Linux"
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make bindir=. installcheck
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
